package com.code.common.models.po;

import com.code.common.enums.ResultCode;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 请求返回结果结构类
 *
 * @param <T>
 */
@Data
public class ResultPagePO<T> implements Serializable {

    private int pageNo;
    private int pageSize;
    private long total = 0;
    private long totalPages = 0;

    private ResultCode code;
    private List<T> data = new ArrayList<T>();

    public ResultPagePO() {
        this.setCode(ResultCode.SUCCESS);
    }

    public ResultPagePO(ResultCode resultCode) {
        this.setCode(resultCode);
    }

    public ResultPagePO(ResultCode resultCode, List<T> result) {
        this.setCode(resultCode);
        this.setData(result);
    }
}
